package com.itheima.Utils;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

public class CookieUtils {
    public static Cookie findCookieByName(HttpServletRequest request,String name){
        Cookie[] cookies = request.getCookies();
        Cookie cookie = null;
        if (cookies!=null){
            for (Cookie c : cookies) {
                if (name.equals(c.getName())){
                    cookie=c;
                }
            }
        }
        return cookie;
    }
}
